/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package pl.squeaky.mvc.model.impl;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.dltk.core.IMethod;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import org.eclipse.emf.ecore.plugin.EcorePlugin;

import pl.squeaky.mvc.model.*;
import pl.squeaky.mvc.model.IAction;
import pl.squeaky.mvc.model.IController;
import pl.squeaky.mvc.model.IControllers;
import pl.squeaky.mvc.model.IModels;
import pl.squeaky.mvc.model.IViews;
import pl.squeaky.mvc.model.MvcFactory;
import pl.squeaky.mvc.model.MvcPackage;
import pl.squeaky.mvc.nature.MvcNature;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class MvcFactoryImpl extends EFactoryImpl implements MvcFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static MvcFactory init() {
		try {
			MvcFactory theMvcFactory = (MvcFactory)EPackage.Registry.INSTANCE.getEFactory("http://squeaky.pl/mvc"); 
			if (theMvcFactory != null) {
				return theMvcFactory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new MvcFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MvcFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
			case MvcPackage.ICONTROLLERS: return createIControllers();
			case MvcPackage.ICONTROLLER: return createIController();
			case MvcPackage.IACTION: return createIAction();
			case MvcPackage.IMODELS: return createIModels();
			case MvcPackage.IMODEL: return createIModel();
			case MvcPackage.IVIEWS: return createIViews();
			case MvcPackage.IVIEW: return createIView();
			default:
				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
			case MvcPackage.IFOLDER:
				return createIFolderFromString(eDataType, initialValue);
			case MvcPackage.IFILE:
				return createIFileFromString(eDataType, initialValue);
			case MvcPackage.MVC_NATURE:
				return createMvcNatureFromString(eDataType, initialValue);
			case MvcPackage.IMETHOD:
				return createIMethodFromString(eDataType, initialValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
			case MvcPackage.IFOLDER:
				return convertIFolderToString(eDataType, instanceValue);
			case MvcPackage.IFILE:
				return convertIFileToString(eDataType, instanceValue);
			case MvcPackage.MVC_NATURE:
				return convertMvcNatureToString(eDataType, instanceValue);
			case MvcPackage.IMETHOD:
				return convertIMethodToString(eDataType, instanceValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public IController createIController() {
		IControllerImpl iController = new IControllerImpl();
		return iController;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public IAction createIAction() {
		IActionImpl iAction = new IActionImpl();
		return iAction;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public IControllers createIControllers() {
		IControllersImpl iControllers = new IControllersImpl();
		return iControllers;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public IModels createIModels() {
		IModelsImpl iModels = new IModelsImpl();
		return iModels;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public IModel createIModel() {
		IModelImpl iModel = new IModelImpl();
		return iModel;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public IViews createIViews() {
		IViewsImpl iViews = new IViewsImpl();
		return iViews;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public IView createIView() {
		IViewImpl iView = new IViewImpl();
		return iView;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public IFolder createIFolderFromString(EDataType eDataType, String initialValue) {
		return (IFolder)super.createFromString(eDataType, initialValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertIFolderToString(EDataType eDataType, Object instanceValue) {
		return super.convertToString(eDataType, instanceValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public IFile createIFileFromString(EDataType eDataType, String initialValue) {
		return (IFile)super.createFromString(eDataType, initialValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertIFileToString(EDataType eDataType, Object instanceValue) {
		return super.convertToString(eDataType, instanceValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MvcNature createMvcNatureFromString(EDataType eDataType, String initialValue) {
		return (MvcNature)super.createFromString(eDataType, initialValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertMvcNatureToString(EDataType eDataType, Object instanceValue) {
		return super.convertToString(eDataType, instanceValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public IMethod createIMethodFromString(EDataType eDataType, String initialValue) {
		return (IMethod)super.createFromString(eDataType, initialValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertIMethodToString(EDataType eDataType, Object instanceValue) {
		return super.convertToString(eDataType, instanceValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MvcPackage getMvcPackage() {
		return (MvcPackage)getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static MvcPackage getPackage() {
		return MvcPackage.eINSTANCE;
	}

} //MvcFactoryImpl
